Сериализация/десериализация ачисел на основе МТС#4
Сериализация/десериализация ачисел на основе МТС#4konard wants to merge 6 commits intonetkeep80:mainfrom
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: netkeep80#3
The base_voc destructor was calling db->clear() which destroyed unique_ptrs, triggering ~rel_t() destructors that tried to erase from maps of already-destroyed objects. Now we release() all unique_ptrs first to prevent destructors from running during static destruction order. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move JSON import/export functions from main.cpp into include/json_io.h so they can be reused by test code and other modules. Main.cpp now includes the shared header instead of defining these functions inline. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add anumber.h with complete implementation of associative number
(ачисло) serialization and deserialization based on the Meta-Theory
of Links (МТС/MTS) draft specification.
Features:
- EBNF grammar: anumber = "∞" { abit }; abit = "1" | "-1" | "(" abit_seq ")"
- 4 abits: 1 (link presence), -1 (link absence), ( (group open), ) (group close)
- Serialization: rel_t graph → anumber string
- Deserialization: anumber string → rel_t graph
- Quaternary notation: -1→0, 1→1, (→2, )→3
- Tokenizer with whitespace tolerance
- 20 test cases (65 assertions) covering roundtrips, edge cases, errors
Updated CMakeLists.txt:
- Cross-platform build (Windows DLL dependency gated by if(WIN32))
- Added test_anumber target with CTest integration
- Version bump 0.0.0 → 0.0.1
Fixes netkeep80#3
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
These scripts were used during development to understand the internal rel_t encoding of strings, numbers, and arrays. Kept for future reference and debugging. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit 5d281a8.
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart 1/3Detected uncommitted changes from previous run. Starting new session to review and commit them. Uncommitted files: Auto-restart will stop after changes are committed or after 2 more iterations. Please wait until working session will end and give your feedback. |
🔄 Auto-restart 1/3 LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Описание / Summary
Реализация сериализации и десериализации ассоциативных чисел (ачисел) на основе черновика Метатеории связей (МТС), как запрошено в issue #3.
Implementation of associative number (anumber) serialization and deserialization based on the Meta-Theory of Links (MTS) draft specification, as requested in issue #3.
Изменения / Changes
Создано / Created
include/anumber.h — Полная реализация сериализации/десериализации ачисел:
anumber = "∞" { abit }; abit = "1" | "-1" | "(" abit_seq ")"; abit_seq = { abit };1(наличие связи),-1(отсутствие связи),((начало группы),)(конец группы)include/json_io.h — Вынесены функции import_json/export_json в общий заголовочный файл для переиспользования в тестах
test/src/test_anumber.cpp — 20 тестов (65 проверок):
experiments/ — Отладочные скрипты для анализа внутренней структуры rel_t
Обновлено / Updated
include/avm.h — Исправлен деструктор base_voc (use-after-free при завершении программы)
src/main.cpp — Рефакторинг: использование json_io.h и anumber.h, вывод ачисла
CMakeLists.txt — Кроссплатформенная сборка, тестовая цель test_anumber с CTest, версия 0.0.0 → 0.0.1
Исправленные баги / Fixed bugs
db->clear()вызывал деструкторыrel_t, которые обращались к картам уже уничтоженных объектов. Исправлено вызовомptr.release()передclear().Тесты / Tests
CTest: 1/1 test passed, 100%.
Чеклист / Checklist
Ссылки / References
Fixes #3
Этот PR был создан с помощью AI issue solver